package com.jimmy.medical.enums;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @Desc: 服务流程枚举类

 * @author jimmy

 * @date 2018-05-01 上午12:32:12
 */
public enum ServiceFlowEnum {
	PHYSICAL_CHECK(1, "体检"),
	SEE_DOCTOR(2, "就诊"),
	SIGN(3, "挂号"),
	EVALUATION(4, "评估"),
	SERVICE(5, "服务"),
	CHECK(6, "开检查");
	
	private int key;	//代码
	private String text;	//名称
	
	ServiceFlowEnum(int key, String text) {
		this.key = key;
		this.text = text;
	}

	/**
	 * 根据key获取名称
	 */
	public static String getTextByKey(int key) {
		for (ServiceFlowEnum obj : ServiceFlowEnum.values()) {
			if (obj.key == key) {
				return obj.text;
			}
		}
		return null;
	}
	
	/**
	 * 将枚举类型转换为Map
	 * @return
	 */
	public static Map<Integer, String> getMapValue() {
		Map<Integer, String> map = new LinkedHashMap<Integer, String>();
		for (ServiceFlowEnum obj : ServiceFlowEnum.values()) {
			map.put(obj.key, obj.text);
		}
		return map;
	}
	
	public int getKey() {
		return key;
	}

	public String getText() {
		return text;
	}
}
